package com.ssslogin.service.impl;

import com.ssslogin.dao.ResumeDao;
import com.ssslogin.pojo.Resume;
import com.ssslogin.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * Created with IntelliJ IDEA by ChouFy on 2020-03-11.
 *
 * @author zhoufy
 */
@Service
public class ResumeServiceImpl implements ResumeService {


    @Autowired
    private ResumeDao resumeDao;

    @Override
    public List<Resume> query() {
        return resumeDao.findByJpql();
    }


    public Resume getByID(long id) {
        Optional<Resume> optional = resumeDao.findById(id);
        if (optional != null) {
            return optional.get();
        } else {
            return null;
        }
    }


    @Override
    public Resume save(Resume resume) {
        return resumeDao.save(resume);
    }

    @Override
    public void delete(Resume resume) {
        resumeDao.delete(resume);
    }
}


